<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>深证通区域股交业务覆盖导图</title>
    <link rel="stylesheet" href="style.css">
    <script src="js/lib/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/lib/raphael-min.js"></script>
    <script type="text/javascript" src="js/res/chinaMapConfig.js"></script>
    <script type="text/javascript" src="js/map-min.js"></script>
    <script type="text/javascript" src="js/data.js"></script>
    <script type="text/javascript" src="js/template.js"></script>
</head>

<body>
    <div class="wrap" style="margin-top: 50px;">
        <h1>深证通区域股交业务覆盖导图</h1>
        <h2>灰色：未涉及；红色：无合作意愿；绿色：沟通中；蓝色：已合作。</h2>
        <div class="itemCon" style="float: left">
            <div id="ChinaMap" style="margin: 10px 50px 50px 50px;"></div>
            <div id="stateTip" style="position: absolute;left: 100%;text-align: left;display: inline;"></div>
        </div>

        <div id="mapTipContent" style="width: 900px;margin: 0 auto;display: none">
            <!-- 看板内容填充 -->
        </div>
    </div>
</body>

<script id="board" type="text/html">
    {{each list as val i}}
    <div class="MyTipText mapTipText mapTipText{{i}}">
        <div class="mapTipImg"><img src={{val.img}} alt={{val.name}} /></div>
        <div class="mapTipList">
            <h2><a href="">{{val.name}}<span>{{val.id}}</span></a></h2>
            <ul>
                {{each val.list as tag}}
                <li>
                    <a href="">【{{tag.name}}】</a>
                    <p>{{tag.text}}</p>
                </li>
                {{/each}}
            </ul>
        </div>
    </div>
    {{/each}}
</script>

<script type="text/javascript">
    function init() {
        //渲染
        $('#ChinaMap').SVGMap({
            // mapWidth: 806,
            // mapHeight: 396
            mapWidth: 1900,
            mapHeight: 1100
        });
    }

    $(function () {
        //构建dom
        var html = template('board', stockData);
        document.getElementById('mapTipContent').innerHTML = html;

        //config数据处理
        stockData.list.forEach(function (val) {
            switch (val.status) {
                case "1":
                    chinaMapConfig.names[val.id].color = "f81f1f"
                    break;
                case "2":
                    chinaMapConfig.names[val.id].color = "66dbaa"
                    break;
                case "3":
                    chinaMapConfig.names[val.id].color = "0d6bc4"
                    break;

                default:
                    chinaMapConfig.names[val.id].color = "a9a9a9"
                    break;
            }
        });
        init();
    });
</script>

</html>